package com.ymatou.riskcontrol.api.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 风控下单接口Call FreeMaker Template自动生成代码
 */
public class RiskEsblishCall extends YmatouBaseCall {
	private static String opurl = "api/order/OrderEstablished";

	public RiskEsblishCall() {
		super(EnvSetup.getSystemUrl("api_riskcontrol"), opurl, "POST", "JSON");
	}

	@Override
	public void addDefHeader() {
		client.addHeader("Accept", "text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取Code
	 * 
	 * @return
	 */
	public String getCode() {
		String Code = null;
		try {
			Code = new JSONObject(getReturnData()).getString("Code");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String BCode = null;
		try {
			BCode = new JSONObject(getReturnData()).getString("Msg");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}

	/**
	 * 获取Status
	 * 
	 * @return
	 */
	public int getStatus() {
		int status = 0;
		try {
			status = new JSONObject(getReturnData()).getInt("Status");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return status;
	}
}